﻿using System;
using System.Collections.Generic;
using System.Text;

using E.Model;
using E.DAL;

namespace E.BLL
{
    public class StudyBLL
    {
        private StudyDAL dal;

        public StudyBLL()
        {
            dal = new StudyDAL();
        }

        /// <summary>
        /// 获取学习记录简单信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public StudyLogModel GetStudyShortLogByID(int id)
        {
            return dal.GetStudyShortLogByID(id);
        }

        /// <summary>
        /// 添加学习记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddStudyLog(StudyLogModel model)
        {
            return dal.AddStudyLog(model);
        }

        /// <summary>
        /// 更新学习记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int UpdateStudyLog(StudyLogModel model)
        {
            return dal.UpdateStudyLog(model);
        }

        /// <summary>
        /// 获取用户学习日志
        /// </summary>
        /// <param name="searchModel"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public StudyLogListModel GetStudyLogByCondition(SearchStudyLogModel searchModel, int pageSize, int pageIndex)
        {
            return dal.GetStudyLogByCondition(searchModel, pageSize, pageIndex);
        }

        /// <summary>
        /// 查询学员学习进度（统计分析）
        /// </summary>
        /// <param name="searchModel"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public StudyLogListModel SearchStudyLog(SearchStudyLogModel searchModel, int pageSize, int pageIndex)
        {
            return dal.SearchStudyLog(searchModel, pageSize, pageIndex);
        }

        #region 内训

        /// <summary>
        /// 获取用户内训课程学习进度
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="courseid"></param>
        /// <returns></returns>
        public int GetUserInternalStudyProcess(int userid, int courseid)
        {
            return dal.GetUserInternalStudyProcess(userid, courseid);
        }

        /// <summary>
        /// 更新进度
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="courseid"></param>
        /// <param name="projectid"></param>
        /// <param name="process"></param>
        /// <returns></returns>
        public int UpdateUserInternalProcess(int userid, int courseid, int projectid, int process)
        {
            return dal.UpdateUserInternalProcess(userid, courseid, projectid, process);
        }

        /// <summary>
        /// 获取用户学习进度
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="courseid"></param>
        /// <returns></returns>
        public IList<InternalStudyModel> GetUserInternalStudyList(int userid, int courseid)
        {
            return dal.GetUserInternalStudyList(userid, courseid);
        }

        /// <summary>
        /// 查询学员学习进度（统计分析）
        /// </summary>
        /// <param name="searchModel"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public StudyLogListModel SearchInternalStudyLog(SearchStudyLogModel searchModel, int pageSize, int pageIndex)
        {
            return dal.SearchInternalStudyLog(searchModel, pageSize, pageIndex);
        }

        #endregion

        #region 公共课程

        /// <summary>
        /// 获取用户学习记录
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="courseid"></param>
        /// <param name="isinternal"></param>
        /// <returns></returns>
        public IList<StudyLogModel> GetUserPublicStudyLog(int userid, int courseid, bool isinternal)
        {
            return dal.GetUserPublicStudyLog(userid, courseid, isinternal);
        }

        /// <summary>
        /// 获取进度
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="courseid"></param>
        /// <returns></returns>
        public int GetUserPublicStudyProgress(int userid, int courseid)
        {
            return dal.GetUserPublicStudyProgress(userid, courseid);
        }

        /// <summary>
        /// 更新进度
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="courseid"></param>
        /// <param name="projectid"></param>
        /// <param name="process"></param>
        /// <param name="chapters"></param>
        /// <returns></returns>
        public int UpdateUserInternalPublicProcess(int userid, int courseid, int projectid, int process, string chapters)
        {
            return dal.UpdateUserInternalPublicProcess(userid, courseid, projectid, process, chapters);
        }

        /// <summary>
        /// 获取学习记录简单信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public StudyLogModel GetPublicStudyShortLogByID(int courseid, int userid)
        {
            return dal.GetPublicStudyShortLogByID(courseid, userid);
        }

        #endregion
    }
}
